<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
 
</head>
<body>
  <div id="app">
    <button @click="changeItem">动态修改不存在的属性</button>
    {{item.name}}
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      data: {
        item: {
        }
      },
      methods: {
        changeItem(){
          // this.item.name = '我是name属性'
          // console.log(this.item);
          this.$set(this.item, 'name', '我是name属性')
        }
      },
    })
    vm.$mount('#app')
  </script>
</body>
</html>